"use client";

import "./index.css";
import QuestionVO = API.QuestionVO;
import { Card } from "antd";
import Title from "antd/es/typography/Title";
import TagList from "@/components/TagList";
import MdViewer from "@/components/MdViewer";
import useAddUserSignInRecord from "@/hooks/useAddUserSignInRecord"; // 组件的样式

// 组件接收的参数
interface Props {
  question: QuestionVO;
}

// 根据参数返回组件渲染的结果
const QuestionCard = (props: Props) => {
  useAddUserSignInRecord();
  const { question } = props; // 解析参数
  // 返回渲染后的结果
  return (
    <div className="question-card">
      <Card>
        <Title level={1}>{question.title}</Title>
        <TagList tagList={question.tagList} />
      </Card>
      <div style={{ marginBottom: 16 }}></div>
      <Card title={"推荐答案"}>
        <MdViewer value={question.answer} />
      </Card>
    </div>
  );
};

export default QuestionCard;
